package IOStream.PrintStream;

import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * ClassName:Dome002
 * Package:IOStream.PrintStream
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/3/3-23:39
 * @Version:v1.0
 */
public class Dome002 {
    /**字符打印流
     * public PrintWriter(OutputStream/File/String) 关联字节输出流/文件/文件路径
     * public PrintWriter(String fileName,Charset charset) 指定字符编码
     * public PrintWriter(OutputStream out,boolean autoFlush) 自动刷新
     * public PrintWriter(OutputStream out,boolean autoFlush,String encoding) 指定字符编码且自动刷新
     *
     * 字符流底层有缓冲区,想要自动刷新需要开启
     * public void write(int b) 写出字节或者字符串
     * public void println(Xxx  xx) 打印任意类型的数据并换行
     * public void print(Xxx  xx) 打印任意类型数据,不换行
     * public void printf(String format，Object...args) 带有占位符的打印语句*/
    public static void main(String[] args) throws IOException {
        PrintWriter pw = new PrintWriter(new FileWriter("E:\\aaa\\b.txt"),true);
        pw.println("今天又是美好的一天");
        pw.print("你好你好");
        pw.printf("%s爱上了%s","阿珍","阿强");
        pw.close();
    }
}
